<!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    var name = 'windowName'

    const obj = {
        name: 'objName',
        sayName: function (a, b) {
            console.log(this.name, a, b)
        }
    }

    const foo = {
        name: 'fooName'
    }

    obj.sayName.apply(globalThis, [1, 2])   // windowName 1 2
    obj.sayName.apply(null, [1, 2])         // windowName 1 2
    obj.sayName.apply(undefined, [1, 2])    // windowName 1 2
    obj.sayName.apply(foo, [1, 2])          // fooName 1 2
    obj.sayName.apply(false, [1, 2])        // undefined 1 2

    console.log(Math.max.apply(null, [1, 2, 3, 4, 5, 6]));  // 6
</script>
</body>
</html>
